package myschool.myshchool15.homework;

import java.util.Scanner;

public class MemberId {
    public static void main(String[] args){
        Scanner input=new Scanner(System.in);

        System.out.println("请输入4位会员卡号：");
        int memberNo = input.nextInt();
        int geWei = memberNo % 10 ;
        int shiWei = memberNo / 10 % 10 ;
        int baiWei = memberNo / 100 % 10 ;
        int qianWei = memberNo / 1000 ;
        int sum = geWei+shiWei+baiWei+qianWei;
        if(memberNo > 999 && memberNo < 10000){
            System.out.println("会员卡号"+memberNo+"各位数之和："+sum);
            boolean sumSize;
            if((sum)>20){
                sumSize = true;
            }else{
                sumSize = false;
            }
            System.out.println("是幸运客户吗？"+sumSize);
        }else{
            System.out.println("请输入正确卡号!");
        }

    }
}
